from common.mysql_operate import MySQLDatabase
from config.mysql_config import DB_CONFIG

def main():
    # 初始化数据库连接
    db = MySQLDatabase(DB_CONFIG)

    # 更新操作示例
    update_data = {'name': '李四'}
    rows_updated = db.update('tb_user', update_data, "id = %s", ('2',))
    print(f"更新了 {rows_updated} 条记录")

    # 关闭连接
    db.close()

if __name__ == "__main__":
    main()